package cn.sylinx.hbatis.ext.starter.util;

import cn.sylinx.hbatis.db.common.FS;
import cn.sylinx.hbatis.ext.mirage.Mirage;
import cn.sylinx.hbatis.ext.mirage.repository.DaoService;
import cn.sylinx.hbatis.kit.StrKit;

public abstract class DAO {

	public static <T> FS<T> createFS(Class<T> clazz) {
		return createFS(null, clazz);
	}

	public static <T> FS<T> createFS(String dsName, Class<T> clazz) {
		return mirage(dsName).createFS(clazz);
	}

	public static DaoService mirage() {
		return Mirage.getDaoService();
	}

	public static DaoService mirage(String dsName) {
		if (StrKit.isBlank(dsName)) {
			return mirage();
		}
		return Mirage.getDaoService(dsName);
	}

	public static DaoService create() {
		return create(null);
	}

	public static DaoService create(String ds) {
		return mirage(ds);
	}

}
